package com.cbtx.module.base

import android.content.Context
import java.lang.IllegalStateException

/**
 * author : joker.peng
 * e-mail : joker@fiture.com
 * date   : 2021/6/10 6:22 PM
 * desc   :
 */
object ContextManager {

    private var context: Context? = null

    fun setContext(context: Context) {
        if (context == null) {
            return
        }
        this.context = context
    }

    fun getContext(): Context {
        if (context == null) {
            throw IllegalStateException("请先调用 ContextManager.setContext（）进行初始化")
        }
        return context!!
    }

    fun clearContext() {
        context = null
    }


}